package com.example.Base;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Window;
import android.widget.Toast;

import com.example.tools.MyProgressBar;

import net.tsz.afinal.FinalHttp;

/**
 * Created by Administrator on 2016/9/26.
 */
public class BaseFragmentActivity extends FragmentActivity {
    protected MyProgressBar mPbar;
    protected FinalHttp mFinalHttp;
    private static Toast mToast = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        mPbar = new MyProgressBar(this);
        mFinalHttp = new FinalHttp();
        mFinalHttp.configTimeout(30000);
    }

    /**
     * 显示Toast提示
     */
    protected void showToast(String text) {
        if (mToast == null) {
            mToast = Toast.makeText(BaseFragmentActivity.this, text,Toast.LENGTH_SHORT);
        } else {
            mToast.setText(text);
            mToast.setDuration(Toast.LENGTH_SHORT);
        }
        mToast.show();
    }
}
